﻿namespace XinGuanERP.Utils
{
    public class ResultUtil
    {
        public ResultEnum Code { set; get; }
        public string Message { set; get; }
        public object? Result { set; get; }


        public ResultUtil(ResultEnum code, string message, object? result)
        {
            this.Code = code;
            this.Message = message;
            this.Result = result;
        }

        public static ResultUtil ok(object? result)
        {
            return new ResultUtil(ResultEnum.SUCCESS, "ok", result);
        }

        public static ResultUtil error(string message)
        {
            return new ResultUtil(ResultEnum.ERROR, message, null);
        }
        public ResultUtil() { }
    }

    public enum ResultEnum
    {
        SUCCESS = 0,
        ERROR = 1,
    }
}
